package com.guaniu.voip.sip;
 
/**
 * INetworkManager 
 * 网络管理
 * @author 
 * @version v1.0
 */

public interface INetworkManager {

	/**
	 * 注册网络回调监听
	 * @param delegate
	 */
	public void registerCallback(NetworkCallback delegate);
	
	/**
	 * 注销网络回调监听
	 * @param delegate
	 */
	public void unRegisterCallback(NetworkCallback delegate);
	
	/**
	 * 得到上次网络状态
	 * @return
	 */
	public NETWORK_STATUS getLastNetworkStatus();

	/**
	 * 得到网络状态
	 * @return
	 */
	public NETWORK_STATUS getNetworkStatus();
	
	/**
	 * 得到网络延迟状态
	 * @return
	 */
	public NETWORK_DELAY_STATUS getDelayStatus();
	
	/**
	 * 判断网络是否连接
	 * @return
	 */
	public boolean isNetworkConnected();
	
	public static enum NETWORK_STATUS{
		NETWORK_STATUS_INIT,
		NETWORK_STATUS_CONNECTED,
		NETWORK_STATUS_CONNECTED_2G,
		NETWORK_STATUS_CONNECTED_3G,
		NETWORK_STATUS_CONNECTED_4G,
		NETWORK_STATUS_CONNECTED_BUT_NET_DELAY_HIGH,
		NETWORK_STATUS_CONNECTED_BUT_NO_NET,
		NETWORK_STATUS_DISCONNECTED
	};
	
	public static enum NETWORK_DELAY_STATUS{
		NETWORK_STATUS_INIT,
		NETWORK_DELAY_NORMAL,//<100
		NETWORK_DELAY_MIDDLE,//<300
		NETWORK_DELAY_HIGH,//<500
		NETWORK_DELAY_VERY_HIGH // > 500
	};
	
	public static interface NetworkCallback{
		public void networkStatus(NETWORK_STATUS status);
		public void networkDelayStatus(NETWORK_DELAY_STATUS status);
	}
}
